home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr44 / frasrc19.zip / INTRO.C < prev    next >
C/C++ Source or Header  |  1995-01-12  |  3KB  |  124 lines

  1.  
  2. /*
  3.  * intro.c
  4.  *
  5.  * FRACTINT intro screen (authors & credits)
  6.  *
  7.  *
  8.  */
  9.  
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12. #include <time.h>
  13. #ifndef XFRACT
  14. #include <dos.h>
  15. #endif
  16.  
  17. #include "fractint.h"
  18. #include "helpdefs.h"
  19. #include "prototyp.h"
  20.  
  21. /* stuff from fractint */
  22.  
  23. #ifdef XFRACT
  24. extern int slowdisplay;
  25. #endif
  26.  
  27. void intro(void)
  28.    {
  29.    /* following overlayed data safe if "putstrings" are resident */
  30.    static FCODE PRESS_ENTER[] = {"Press ENTER for main menu, F1 for help."};
  31.    int         toprow, botrow, i, j, delaymax;
  32.    char      oldchar;
  33.    int         authors[100];        /* this should be enough for awhile */
  34.    char far *credits;
  35.    char far *screen_text;
  36.    int         oldlookatmouse;
  37.    int         oldhelpmode;
  38.  
  39.    timer_start -= clock_ticks();        /* "time out" during help */
  40.    oldlookatmouse = lookatmouse;
  41.    oldhelpmode = helpmode;
  42.    lookatmouse = 0;            /* de-activate full mouse checking */
  43.  
  44.    screen_text = MK_FP(extraseg, 0);
  45.  
  46.    i = 32767 + read_help_topic(INTRO_AUTHORS, 0, 32767, screen_text);
  47.    screen_text[i++] = '\0';
  48.    credits = screen_text + i;
  49.    i = 32767 + read_help_topic(INTRO_CREDITS, 0, 32767, credits);
  50.    credits[i++] = '\0';
  51.  
  52.    j = 0;
  53.    authors[j] = 0;        /* find the start of each credit-line */
  54.    for (i = 0; credits[i] != 0; i++)
  55.       if (credits[i] == 10)
  56.      authors[++j] = i+1;
  57.    authors[j+1] = i;
  58.  
  59.    helptitle();
  60.    toprow = 8;
  61. #ifndef XFRACT
  62.    botrow = 21;
  63. #else
  64.    botrow = 20;
  65.    putstringcenter(21,0,80,C_TITLE,
  66.    "Unix/X port of fractint by Ken Shirriff [shirriff@cs.Berkeley.EDU]");
  67. #endif
  68.    putstringcenter(1,0,80,C_TITLE, PRESS_ENTER);
  69.    putstring(2,0,C_CONTRIB,screen_text);
  70.    setattr(2,0,C_AUTHDIV1,80);
  71.    setattr(7,0,C_AUTHDIV1,80);
  72.    setattr(22,0,C_AUTHDIV2,80);
  73.    setattr(3,0,C_PRIMARY,320);
  74.    setattr(23,0,C_TITLE_LOW,160);
  75.    for (i = 3; i < 7; ++i)
  76.       setattr(i,18,C_CONTRIB,60);
  77.    setattr(toprow,0,C_CONTRIB,14*80);
  78.    i = botrow - toprow;
  79.    srand((unsigned int)clock_ticks());
  80.    j = rand15()%(j-(botrow-toprow)); /* first to use */
  81.    i = j+botrow-toprow; /* last to use */
  82.    oldchar = credits[authors[i+1]];
  83.    credits[authors[i+1]] = 0;
  84.    putstring(toprow,0,C_CONTRIB,credits+authors[j]);
  85.    credits[authors[i+1]] = oldchar;
  86.    delaymax = 10;
  87.    movecursor(25,80); /* turn it off */
  88.    helpmode = HELPMENU;
  89.    while (! keypressed())
  90.       {
  91. #ifdef XFRACT
  92.       if (slowdisplay) delaymax *= 15;
  93. #endif
  94.       for (j = 0; j < delaymax && !(keypressed()); j++)
  95.      delay(100);
  96.       if (keypressed() == 32)
  97.      {    /* spacebar pauses */
  98.      getakey();
  99. #ifndef XFRACT
  100.          while (!keypressed()) ;
  101. #else
  102.          waitkeypressed(0);
  103. #endif
  104.      if (keypressed() == 32)
  105.         getakey();
  106.      }
  107.       delaymax = 15;
  108.       scrollup(toprow, botrow);
  109.       i++;
  110.       if (credits[authors[i]] == 0)
  111.      i = 0;
  112.       oldchar = credits[authors[i+1]];
  113.       credits[authors[i+1]] = 0;
  114.       putstring(botrow,0,C_CONTRIB,&credits[authors[i]]);
  115.       setattr(botrow,0,C_CONTRIB,80);
  116.       credits[authors[i+1]] = oldchar;
  117.       movecursor(25,80); /* turn it off */
  118.       }
  119.  
  120.    lookatmouse = oldlookatmouse;        /* restore the mouse-checking */
  121.    helpmode = oldhelpmode;
  122.    return ;
  123.    }
  124.